import React from 'react';
import { Router, Route, Switch } from 'dva/router';
import dynamic from 'dva/dynamic';
import { LocaleProvider } from 'antd';
import zh_CN from 'antd/lib/locale-provider/zh_CN';
import 'antd-mobile/dist/antd-mobile.css';
import 'moment/locale/zh-cn';

const routes = [
	{
		path: '/',
		// models: () => [import('./models/app')],
		component: () => import('./routes/HomePage'),
	},
	{
		path: '/App*',
		component: () => import('./routes')
	},
	// {
	// 	path: '/threeLists',
	// 	component: () => import('./routes/ThreeLists'),
	// },
	// {
	// 	path: '/threeLists/projectItems',
	// 	component: () => import('./routes/ThreeLists/pages/Items'),
	// },
	// {
	// 	path: '/threeLists/projectDetails',
	// 	component: () => import('./routes/ThreeLists/pages/Details')
	// }
];

function RouterConfig({ history, app }) {
	return (
		<LocaleProvider locale={zh_CN}>
			<Router history={history}>
				<div>
					<Switch>
						{
							routes.map(({ path, ...dynamics }, key) => (
								<Route
									key={path}
									exact
									path={path}
									component={dynamic({
										app,
										...dynamics,
									})}
								/>
							))
						}
					</Switch>
				</div>
			</Router>
		</LocaleProvider>
	);
}

export default RouterConfig;
module.exports = RouterConfig;